const express =require("express");
const app =express()
const port =8080;

//定义账号和密码
const users = [ { username: 'admin', password: 'password123' } ];

//连接端口
app.get("/login",(req,res)=>{
    let user = users.find(i => i.username == req.query.username && i.password == req
        .query.password);
        // console.log(user)
        if(user){
        res.json({code:200,msg:"登录成功了"})
        }else{
        res.json({code:404,msg:"登录失败，请查询账号是否存在或密码错误"})
        }
}).listen("8080")
console.log("8080端口号已经启动")